package com.loan.system.service;

import com.alibaba.fastjson.JSONObject;
import com.loan.common.core.domain.PageQuery;
import com.loan.common.core.page.TableDataInfo;
import com.loan.system.domain.ApplyEntity;
import com.loan.system.domain.CollectionLogEntity;
import com.loan.system.domain.RepaymentLogEntity;
import com.loan.system.domain.vo.ExamineUserVo;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

/**
 * @author shiguang on 2022/9/7 14:57
 */
public interface ApplyService {

    TableDataInfo<ApplyEntity> selectPageList(ApplyEntity entity, PageQuery pageQuery, String overStatus, Integer applyType, String isDivide, String isRemark);

    /**
     * 获取审核人员
     *
     * @return
     */
    List<ExamineUserVo> listExamineUser();

    /**
     * 获取催收人员
     *
     * @return
     */
    List<ExamineUserVo> listCollectionUser();

    List<ApplyEntity> applyLogList(Long userId);

    /**
     * 初审订单分配
     *
     * @param oneExamineBy
     * @param ids
     * @return
     */
    int updateApplyOneExamineBy(Long oneExamineBy, String ids);

    int updateApplyTwoExamineBy(Long twoExamineBy, String ids);

    /**
     * 打款
     *
     * @param applyId
     * @param type
     * @param bankOrderNo
     * @return
     */
    int payApply(Long applyId, String type, String bankOrderNo);

    /**
     * 还款
     *
     * @param applyId
     * @param type
     * @param paymentMoney
     * @param status
     * @return
     */
    int paymentApply(Long applyId, String type, Integer paymentMoney, String status);

    void calculationApplyInterestByDay();

    void pay();

    /**
     * 查询订单状态
     */
    void queryPayOrderApply();

    /**
     * 关闭订单
     *
     * @param ids
     * @return
     */
    int closeApply(String ids);

    String updateApplyByMsg(HttpServletRequest request);

    void checkPaymentData(JSONObject data, String signature);

    void sendPaymentBeforeDay();

    void sendPaymentDay();

    void sendPaymentOverDay();

    void updateOverApply();

    int addOverLogForm(JSONObject params);

    List<CollectionLogEntity> overLogList(Long userId);

    List<ApplyEntity> listApplyCompany(ApplyEntity entity);

    ApplyEntity getInfo(Long id, Long userId);

    TableDataInfo<RepaymentLogEntity> selectRepaymentLogList(RepaymentLogEntity entity, PageQuery pageQuery);

    /**
     * 撤销还款记录
     *
     * @param id
     * @return
     */
    int revokeRepaymentLog(String id);

    int updateApplyCutomerBy(Long customerBy, String ids);

    TableDataInfo<ApplyEntity> selectPageListOver(ApplyEntity entity,String isRemark, PageQuery pageQuery);

    TableDataInfo<ApplyEntity> selectPageListMyOver(ApplyEntity entity, String overStatus, String remark, PageQuery pageQuery);

    void saveOrUpdateApplyCollectionByJobHandle();

    TableDataInfo<ApplyEntity> selectPageListUserInfo(ApplyEntity entity, PageQuery pageQuery);

    TableDataInfo<ApplyEntity> selectPageListTwoExamine(ApplyEntity entity, PageQuery pageQuery, String examineStatus);

    /**
     * 待终审列表
     *
     * @param entity
     * @param pageQuery
     * @return
     */
    TableDataInfo<ApplyEntity> selectPageListTwo(ApplyEntity entity, PageQuery pageQuery);

    TableDataInfo<ApplyEntity> selectPageListFirstExamine(ApplyEntity entity, PageQuery pageQuery, String examineStatus);

    TableDataInfo<ApplyEntity> selectPageListFirst(ApplyEntity entity, PageQuery pageQuery);

    TableDataInfo<ApplyEntity> selectSearchList(String userName, String orderSn, String userPhone, String status, String overStatus, Integer applyType, Long companyId, PageQuery pageQuery);

    /**
     * 获取可催回案件
     *
     * @param entity
     * @param pageQuery
     * @return
     */
    TableDataInfo<ApplyEntity> selectPageListOverRepayment(ApplyEntity entity, PageQuery pageQuery);

    TableDataInfo<ApplyEntity> selectPageListWaiPayment(ApplyEntity entity, PageQuery pageQuery);

    /**
     * 催收订单分配
     *
     * @param collectionBy
     * @param ids
     * @return
     */
    int updateApplyCollectionBy(Long collectionBy, String ids);

    List<Map<String, Object>> selectPageCapitalBack(String beginTime, String endTime);

    TableDataInfo<Map<String, Object>> selectCompanyDataList(String beginTime, String endTime, Long companyId, PageQuery pageQuery);

    TableDataInfo<Map<String, Object>> selectPayDataList(String beginTime, String endTime, Long customerId, PageQuery pageQuery);

    Map<String, Object> selectPayDataTotal(String beginTime, String endTime, Long customerId);

    TableDataInfo<ApplyEntity> selectPageWaitWithdrawallist(ApplyEntity entity, PageQuery pageQuery, String overStatus, Integer applyType, String isDivide, String isRemark);

    TableDataInfo<ApplyEntity> selectPageFailList(Long userId, String orderSn, String userName, String userPhone, String status, String overStatus, String applyType, String createStartTime, String createEndTime, String examineStartTime, String examineEndTime, PageQuery pageQuery);

    int recoveryApply(Long id);

    void updateApplyWithdrawalStatus();

    void robotApply();

    /**
     * 放款成功列表
     *
     * @param entity
     * @param applyStartTime
     * @param applyEndTime
     * @param pageQuery
     * @return
     */
    TableDataInfo<ApplyEntity> selectPagePaySuccessList(ApplyEntity entity, String applyStartTime, String applyEndTime, PageQuery pageQuery);

    /**
     * 获取待打款列表
     *
     * @param entity
     * @param applyStartTime
     * @param applyEndTime
     * @param pageQuery
     * @return
     */
    TableDataInfo<ApplyEntity> selectPageWaitPayList(ApplyEntity entity, String applyStartTime, String applyEndTime, PageQuery pageQuery);

    /**
     * 获取放款失败列表
     *
     * @param entity
     * @param applyStartTime
     * @param applyEndTime
     * @param pageQuery
     * @return
     */
    TableDataInfo<ApplyEntity> selectPagePayFailsList(ApplyEntity entity, String applyStartTime, String applyEndTime, PageQuery pageQuery);

    /**
     * 获取还款成功列表
     *
     * @param entity
     * @param pageQuery
     * @return
     */
    TableDataInfo<ApplyEntity> selectPageRepaySuccessList(ApplyEntity entity, PageQuery pageQuery);

    /**
     * 商户未分配数据统计
     */
    void companyUnassignedData();

    /**
     * 提现监督报表统计
     */
    void withdrawalSuperviseData();

    /**
     * 查询虚拟账户是否还款
     */
    void queryHqVaRepayLog();

    /**
     * 添加跟进
     * @param
     * @return
     */
    int saveFollowUpRemarkById(Long id,String followUpRemark);
}
